<?php


namespace app\admin\logic;

use app\admin\model\Project_2021 as ProjectModel;

class Project extends BaseLogic
{

    protected $model;

    public function __construct()
    {
        parent::__construct();
        $this->model = new ProjectModel();

    }

    function updateDispathPno($name,$pno)
    {

        $dispatchmodel = new \app\admin\model\Dispatch();
        $row = $dispatchmodel->where(['name'=>$name])->find();
        if($row && $row->project_pno!=$pno)
        {
            $row->project_pno = $pno;
            $row->save();
        }

    }


    public function addProject($year,$params,$value) {
        if($year == 2020)
            $projectmodel = new \app\admin\model\Project();
        if($year == 2021)
            $projectmodel = new \app\admin\model\Project_2021();

        $row = $projectmodel->where(['pno|name'=>$value])->find();
    }



}
